package com.loong.data.service.impl;


import com.loong.common.dubbo.service.AbstractService;
import com.loong.common.rest.rpc.RPCResponse;
import com.loong.data.dto.ShopAndRecommendGoodsDTOResult;
import com.loong.data.dto.ShopDTOResult;
import com.loong.data.handler.ShopHandler;
import com.loong.data.param.DistanceAndShopIdListRPCParam;
import com.loong.data.service.IShopService;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;
import java.util.List;

@DubboService(timeout = 5000,interfaceClass = IShopService.class)
public class ShopServiceImpl extends AbstractService implements IShopService {

    @Resource
    private ShopHandler shopHandler;

    @Override
    public RPCResponse<ShopDTOResult> findShopModelById(Long shopId) {
        return serviceExecutor.execute(()->shopHandler.commonFindShopById(shopId));
    }

    @Override
    public RPCResponse<ShopAndRecommendGoodsDTOResult> findShopAndRecommendGoodsById(Long shopId) {
        return serviceExecutor.execute(() -> shopHandler.foreheadFindShopAndRecommendGoodsById(shopId));
    }

    @Override
    public RPCResponse<List<ShopDTOResult>> findShopByIdList(DistanceAndShopIdListRPCParam param) {
        return serviceExecutor.execute(() -> shopHandler.foreheadFindShopByIdList(param));
    }
}
